package com.canbot.u05.bean.preside;

import android.text.TextUtils;


/**
 * Created by zmp on 2018/4/24.
 */

public class PresideTaskNode{

        private int type;

        private MoveBean moveBean;

        private DanceBean danceBean;

        private LanguageBean languageBean;

        public boolean isSelected() {
                return isSelected;
        }

        public void setSelected(boolean selected) {
                isSelected = selected;
        }

        private boolean isSelected;

        public PresideTaskNode() {
        }

        public PresideTaskNode(MoveBean moveBean) {
                this.moveBean = moveBean;
                this.type = PresideModule.MOVE_TYPE;
        }

        public PresideTaskNode(DanceBean danceBean) {
                this.danceBean = danceBean;
                this.type = PresideModule.DANCE_TYPE;
        }

        public PresideTaskNode(LanguageBean languageBean) {
                this.languageBean = languageBean;
                this.type = PresideModule.LANGUAGE_TYPE;
        }


        public DanceBean getDanceBean() {
                return danceBean;
        }

        public void setDanceBean(DanceBean danceBean) {
                this.danceBean = danceBean;
        }

        public LanguageBean getLanguageBean() {
                return languageBean;
        }

        public void setLanguageBean(LanguageBean languageBean) {
                this.languageBean = languageBean;
        }

        public MoveBean getMoveBean() {
                return moveBean;
        }

        public void setMoveBean(MoveBean moveBean) {
                this.moveBean = moveBean;
        }

        public int getType() {
                return type;
        }

        public void setType(int type) {
                this.type = type;
        }

        @Override
        public String toString() {
                return "PresideTaskNode{" + "type=" + type + ", danceBean=" + danceBean + ", languageBean=" + languageBean + ", moveBean=" + moveBean + '}';
        }

        public PresideTaskNode(int type) {
                this.type = type;
                switch(type) {
                        case PresideModule.DANCE_TYPE:
                                this.danceBean = new DanceBean();
                                break;
                        case PresideModule.LANGUAGE_TYPE:
                                this.languageBean = new LanguageBean();
                                this.languageBean.voiceBean = new VoiceBean();
                                this.languageBean.actionBean = new ActionBean();
                                break;
                        case PresideModule.MOVE_TYPE:
                                this.moveBean = new MoveBean();
                                this.moveBean.voiceBean = new VoiceBean();
                                break;
                }
        }

        public static class DanceBean{

                public String danceID;

                public String content;

                public String actionID;

                public DanceBean() {
                }

                public DanceBean(String danceID, String content, String actionID) {
                        this.danceID = danceID;
                        this.content = content;
                        this.actionID = actionID;
                }

                @Override
                public String toString() {
                        return "DanceBean{" + "danceID='" + danceID + '\'' + ", content='" + content + '\'' + '}';
                }
        }

        public static class MoveBean{

                public String speed;

                public String orientation;

                public String distance;

                public MoveBean(String speed, String orientation, String distance) {
                        this.speed = speed;
                        this.orientation = orientation;
                        this.distance = distance;
                }

                public MoveBean() {
                }

                public VoiceBean voiceBean;

                public String hasMoveContent() {
                        if (TextUtils.isEmpty(orientation)) {
                                return null;
                        }
                        String unit = "米";
                        switch(orientation) {
                                case "前进":
                                case "后退":
                                        unit = "米";
                                        break;
                                case "左转":
                                case "右转":
                                        unit = "度";
                                        break;
                        }
                        return speed + orientation + distance + unit;
                }
        }

        public static class LanguageBean{

                public VoiceBean voiceBean;

                public ActionBean actionBean;
        }

        public static class VoiceBean{

                public int languageType;

                public String name;

                public String path;

                public VoiceBean() {
                }

                public VoiceBean(int languageType, String name, String path) {
                        this.languageType = languageType;
                        this.name = name;
                        this.path = path;
                }
        }

        public static class ActionBean{

                public String actionId;

                public String actionName;

                public ActionBean() {
                }

                public ActionBean(String actionId, String actionName) {
                        this.actionId = actionId;
                        this.actionName = actionName;
                }
        }
}
